

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
    <style>
    /* base */
    html,
    body,
    .container {
      width: 100%;
      height: 100%;
    }

    a,
    a:link,
    a:visited {
      text-decoration: none;
      color: inherit;
    }

    ul {
      list-style: none;
    }

    *,
    ::before,
    ::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    *:focus {
      outline: 0;
    }

    .container {
      display: flex;
      padding-top: 20px;
    }

    /* Nav */
    .container .doc-nav {
      position: fixed;
      height: 100%;
      margin: 0 30px 0 40px;
      width: 280px;
    }

    .doc-nav .nav-header {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      background-color: rgb(240, 241, 242);
      height: 40px;
      padding: 16px;
      font-size: 18px;
      font-weight: 500;
      color: rgb(62, 64, 66);
      cursor: pointer;
    }

    .doc-nav .nav-content {
      height: calc(100% - 40px);
      overflow-y: auto;
      color: rgb(32, 34, 36);
    }

    .doc-nav .nav-content .nav-list,
    .doc-nav .nav-content .nav-sub-list {
      line-height: 1.5rem;
    }

    .doc-nav .nav-content .nav-label {
      display: inline-block;
      position: relative;
      padding: 2px 0 2px 20px;
      margin-bottom: 4px;
    }

    .doc-nav .nav-content .nav-sub-label {
      position: relative;
      padding: 2px 0 2px 40px;
      font-size: 14px;
    }

    .doc-nav .nav-content .nav-sub-label:hover {
      text-decoration: underline;
    }

    .doc-nav .nav-content .nav-list .nav-label.group::before {
      border-bottom: 0.25rem solid transparent;
      border-left: 0.25rem solid #6e7072;
      border-right: 0;
      border-top: 0.25rem solid transparent;
      content: '';
      display: block;
      height: 0;
      left: 0.5rem;
      position: absolute;
      top: 0.625rem;
      transition: transform 0.1s linear;
      width: 0;
    }

    .doc-nav .nav-content .nav-list .nav-label.group.active::before {
      transform: rotate(90deg);
    }

    /* doc content */
    .container .doc-content {
      position: fixed;
      height: 100%;
      width: calc(100% - 80px - 40px - 30px - 240px);
      right: 0%;
      overflow-y: auto;
    }

    .doc-title {
      border-bottom: 1px solid #dcdee0;
      font-size: 22px;
      margin: 8px 0 0;
      padding-bottom: 16px;
    }

    .doc-content h3 {
      font-size: 24px;
      font-weight: 600;
      margin: 24px 0;
    }

    .doc-content h4 {
      font-size: 22px;
      font-weight: 500;
      margin: 30px 0 8px;
    }

    .doc-content h4 span {
      color: #007d9c;
    }

    .doc-content .doc-declare {
      background-color: #fafafa;
      border-radius: 5px;
      border: 1px solid #ccc;
      font-size: 14px;
      overflow-x: auto;
      padding: 10px;
      tab-size: 4;
      line-height: 20px;
    }

    .doc-content .doc-comment {
      font-size: 16px;
      margin: 16px 0;
      line-height: 24px;
      word-break: break-word;
    }
  </style>

</head>
<body>
  <div class="container">
    <div class="doc-nav">
      <a href="#Documentation" class="nav-header">Documentation</a>
      <nav class="nav-content">
        <ul class="nav-list">
          <li>
            <a href="#includes" class="nav-label">Includes</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#uthash.h" class="nav-sub-label">uthash.h</a>
              </li>
      

              <li>
                <a href="#async.h" class="nav-sub-label">async.h</a>
              </li>
      

              <li>
                <a href="#str.h" class="nav-sub-label">str.h</a>
              </li>
      

              <li>
                <a href="#pdu.h" class="nav-sub-label">pdu.h</a>
              </li>
      

              <li>
                <a href="#coap_net.h" class="nav-sub-label">coap_net.h</a>
              </li>
      

              <li>
                <a href="#subscribe.h" class="nav-sub-label">subscribe.h</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#macros" class="nav-label">Macros</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#COAP_RESOURCE_H_" class="nav-sub-label">COAP_RESOURCE_H_</a>
              </li>
      

              <li>
                <a href="#COAP_RESOURCE_CHECK_TIME" class="nav-sub-label">COAP_RESOURCE_CHECK_TIME</a>
              </li>
      

              <li>
                <a href="#COAP_ATTR_FLAGS_RELEASE_NAME" class="nav-sub-label">COAP_ATTR_FLAGS_RELEASE_NAME</a>
              </li>
      

              <li>
                <a href="#COAP_ATTR_FLAGS_RELEASE_VALUE" class="nav-sub-label">COAP_ATTR_FLAGS_RELEASE_VALUE</a>
              </li>
      

              <li>
                <a href="#COAP_RESOURCE_FLAGS_RELEASE_URI" class="nav-sub-label">COAP_RESOURCE_FLAGS_RELEASE_URI</a>
              </li>
      

              <li>
                <a href="#COAP_RESOURCE_FLAGS_NOTIFY_NON" class="nav-sub-label">COAP_RESOURCE_FLAGS_NOTIFY_NON</a>
              </li>
      

              <li>
                <a href="#COAP_RESOURCE_FLAGS_NOTIFY_CON" class="nav-sub-label">COAP_RESOURCE_FLAGS_NOTIFY_CON</a>
              </li>
      

              <li>
                <a href="#COAP_PRINT_STATUS_MASK" class="nav-sub-label">COAP_PRINT_STATUS_MASK</a>
              </li>
      

              <li>
                <a href="#COAP_PRINT_OUTPUT_LENGTH(v)" class="nav-sub-label">COAP_PRINT_OUTPUT_LENGTH(v)</a>
              </li>
      

              <li>
                <a href="#COAP_PRINT_STATUS_ERROR" class="nav-sub-label">COAP_PRINT_STATUS_ERROR</a>
              </li>
      

              <li>
                <a href="#COAP_PRINT_STATUS_TRUNC" class="nav-sub-label">COAP_PRINT_STATUS_TRUNC</a>
              </li>
      

              <li>
                <a href="#RESOURCES_ADD(r, obj)" class="nav-sub-label">RESOURCES_ADD(r, obj)</a>
              </li>
      

              <li>
                <a href="#RESOURCES_DELETE(r, obj)" class="nav-sub-label">RESOURCES_DELETE(r, obj)</a>
              </li>
      

              <li>
                <a href="#RESOURCES_ITER(r,tmp)" class="nav-sub-label">RESOURCES_ITER(r,tmp)</a>
              </li>
      

              <li>
                <a href="#RESOURCES_FIND(r, k, res)" class="nav-sub-label">RESOURCES_FIND(r, k, res)</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#functions" class="nav-label">Functions</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#coap_add_resource" class="nav-sub-label">coap_add_resource</a>
              </li>
      

              <li>
                <a href="#coap_delete_resource" class="nav-sub-label">coap_delete_resource</a>
              </li>
      

              <li>
                <a href="#coap_delete_all_resources" class="nav-sub-label">coap_delete_all_resources</a>
              </li>
      

              <li>
                <a href="#coap_delete_attr" class="nav-sub-label">coap_delete_attr</a>
              </li>
      

              <li>
                <a href="#coap_print_link" class="nav-sub-label">coap_print_link</a>
              </li>
      

              <li>
                <a href="#coap_register_handler" class="nav-sub-label">coap_register_handler</a>
              </li>
      

              <li>
                <a href="#coap_touch_observer" class="nav-sub-label">coap_touch_observer</a>
              </li>
      

              <li>
                <a href="#coap_delete_observer" class="nav-sub-label">coap_delete_observer</a>
              </li>
      

              <li>
                <a href="#coap_delete_observers" class="nav-sub-label">coap_delete_observers</a>
              </li>
      

              <li>
                <a href="#coap_check_notify" class="nav-sub-label">coap_check_notify</a>
              </li>
      

              <li>
                <a href="#coap_print_wellknown" class="nav-sub-label">coap_print_wellknown</a>
              </li>
      

              <li>
                <a href="#coap_handle_failed_notify" class="nav-sub-label">coap_handle_failed_notify</a>
              </li>
      

              <li>
                <a href="#coap_resource_notify_observers" class="nav-sub-label">coap_resource_notify_observers</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#vars" class="nav-label">Vars</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#coap_resource_t" class="nav-sub-label">coap_resource_t</a>
              </li>
      

              <li>
                <a href="#coap_resource_t" class="nav-sub-label">coap_resource_t</a>
              </li>
      

              <li>
                <a href="#coap_attr_t" class="nav-sub-label">coap_attr_t</a>
              </li>
      

              <li>
                <a href="#coap_attr_t" class="nav-sub-label">coap_attr_t</a>
              </li>
      

              <li>
                <a href="#coap_resource_t" class="nav-sub-label">coap_resource_t</a>
              </li>
      

              <li>
                <a href="#coap_subscription_t" class="nav-sub-label">coap_subscription_t</a>
              </li>
      

              <li>
                <a href="#coap_subscription_t" class="nav-sub-label">coap_subscription_t</a>
              </li>
      

              <li>
                <a href="#COAP_DEPRECATED" class="nav-sub-label">COAP_DEPRECATED</a>
              </li>
      
            </ul>
            
          </li>
          <li>
            <a href="#consts" class="nav-label">Consts</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#types" class="nav-label">Types</a>
            
            <ul class="nav-sub-list">
            
            </ul>
            
          </li>
          <li>
            <a href="#typedefs" class="nav-label">Typedefs</a>
             
            <ul class="nav-sub-list">

              <li>
                <a href="#coap_method_handler_t" class="nav-sub-label">coap_method_handler_t</a>
              </li>
      

              <li>
                <a href="#coap_attr_t;
" class="nav-sub-label">coap_attr_t;
</a>
              </li>
      

              <li>
                <a href="#coap_resource_t;
" class="nav-sub-label">coap_resource_t;
</a>
              </li>
      

              <li>
                <a href="#coap_print_status_t" class="nav-sub-label">coap_print_status_t</a>
              </li>
      
            </ul>
            
          </li>
        </ul>
      </nav>
    </div>
    <div class="doc-content">
      <h2 id="Documentation" class="doc-title">Documentation</h2>
      <h3 id="includes">Includes</h3>
      

      <h4 id="uthash.h"><span>uthash.h</span></h4>
      <pre class="doc-declare"><code>#include "uthash.h"
</code></pre>
      <pre class="doc-comment">#include "uthash.h"
</pre>

      <h4 id="async.h"><span>async.h</span></h4>
      <pre class="doc-declare"><code>#include "async.h"
</code></pre>
      <pre class="doc-comment">#include "async.h"
</pre>

      <h4 id="str.h"><span>str.h</span></h4>
      <pre class="doc-declare"><code>#include "str.h"
</code></pre>
      <pre class="doc-comment">#include "str.h"
</pre>

      <h4 id="pdu.h"><span>pdu.h</span></h4>
      <pre class="doc-declare"><code>#include "pdu.h"
</code></pre>
      <pre class="doc-comment">#include "pdu.h"
</pre>

      <h4 id="coap_net.h"><span>coap_net.h</span></h4>
      <pre class="doc-declare"><code>#include "coap_net.h"
</code></pre>
      <pre class="doc-comment">#include "coap_net.h"
</pre>

      <h4 id="subscribe.h"><span>subscribe.h</span></h4>
      <pre class="doc-declare"><code>#include "subscribe.h"
</code></pre>
      <pre class="doc-comment">#include "subscribe.h"
</pre>
      <h3 id="macros">Macros</h3>
      

      <h4 id="COAP_RESOURCE_H_">Marco <span>COAP_RESOURCE_H_</span></h4>
      <pre class="doc-declare"><code>#define COAP_RESOURCE_H_
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="COAP_RESOURCE_CHECK_TIME">Marco <span>COAP_RESOURCE_CHECK_TIME</span></h4>
      <pre class="doc-declare"><code>#define COAP_RESOURCE_CHECK_TIME 2
</code></pre>
      <pre class="doc-comment">/** The interval in seconds to check if resources have changed. */</pre>

      <h4 id="COAP_ATTR_FLAGS_RELEASE_NAME">Marco <span>COAP_ATTR_FLAGS_RELEASE_NAME</span></h4>
      <pre class="doc-declare"><code>#define COAP_ATTR_FLAGS_RELEASE_NAME 1
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="COAP_ATTR_FLAGS_RELEASE_VALUE">Marco <span>COAP_ATTR_FLAGS_RELEASE_VALUE</span></h4>
      <pre class="doc-declare"><code>#define COAP_ATTR_FLAGS_RELEASE_VALUE 2
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="COAP_RESOURCE_FLAGS_RELEASE_URI">Marco <span>COAP_RESOURCE_FLAGS_RELEASE_URI</span></h4>
      <pre class="doc-declare"><code>#define COAP_RESOURCE_FLAGS_RELEASE_URI 1
</code></pre>
      <pre class="doc-comment">/** The URI passed to coap_resource_init() is free'd by coap_delete_resource(). */</pre>

      <h4 id="COAP_RESOURCE_FLAGS_NOTIFY_NON">Marco <span>COAP_RESOURCE_FLAGS_NOTIFY_NON</span></h4>
      <pre class="doc-declare"><code>#define COAP_RESOURCE_FLAGS_NOTIFY_NON 0
</code></pre>
      <pre class="doc-comment">/**
 * Notifications will be sent non-confirmable by default. RFC 7641 Section 4.5
 * https://tools.ietf.org/html/rfc7641#section-4.5
 */</pre>

      <h4 id="COAP_RESOURCE_FLAGS_NOTIFY_CON">Marco <span>COAP_RESOURCE_FLAGS_NOTIFY_CON</span></h4>
      <pre class="doc-declare"><code>#define COAP_RESOURCE_FLAGS_NOTIFY_CON 2
</code></pre>
      <pre class="doc-comment">/**
 * Notifications will be sent confirmable by default. RFC 7641 Section 4.5
 * https://tools.ietf.org/html/rfc7641#section-4.5
 */</pre>

      <h4 id="COAP_PRINT_STATUS_MASK">Marco <span>COAP_PRINT_STATUS_MASK</span></h4>
      <pre class="doc-declare"><code>#define COAP_PRINT_STATUS_MASK 4026531840u
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="COAP_PRINT_OUTPUT_LENGTH(v)">Marco <span>COAP_PRINT_OUTPUT_LENGTH(v)</span></h4>
      <pre class="doc-declare"><code>#define COAP_PRINT_OUTPUT_LENGTH(v) ((v) & ~COAP_PRINT_STATUS_MASK)
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="COAP_PRINT_STATUS_ERROR">Marco <span>COAP_PRINT_STATUS_ERROR</span></h4>
      <pre class="doc-declare"><code>#define COAP_PRINT_STATUS_ERROR 2147483648u
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="COAP_PRINT_STATUS_TRUNC">Marco <span>COAP_PRINT_STATUS_TRUNC</span></h4>
      <pre class="doc-declare"><code>#define COAP_PRINT_STATUS_TRUNC 1073741824u
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="RESOURCES_ADD(r, obj)">Marco <span>RESOURCES_ADD(r, obj)</span></h4>
      <pre class="doc-declare"><code>#define RESOURCES_ADD(r, obj) \
 HASH_ADD(hh, (r), uri_path->s[0], (obj)->uri_path->length, (obj))
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="RESOURCES_DELETE(r, obj)">Marco <span>RESOURCES_DELETE(r, obj)</span></h4>
      <pre class="doc-declare"><code>#define RESOURCES_DELETE(r, obj) \
 HASH_DELETE(hh, (r), (obj))
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="RESOURCES_ITER(r,tmp)">Marco <span>RESOURCES_ITER(r,tmp)</span></h4>
      <pre class="doc-declare"><code>#define RESOURCES_ITER(r,tmp) \
 coap_resource_t *tmp, *rtmp; \
 HASH_ITER(hh, (r), tmp, rtmp)
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="RESOURCES_FIND(r, k, res)">Marco <span>RESOURCES_FIND(r, k, res)</span></h4>
      <pre class="doc-declare"><code>#define RESOURCES_FIND(r, k, res) {                    \
   HASH_FIND(hh, (r), (k)->s, (k)->length, (res)); \
 }
</code></pre>
      <pre class="doc-comment"></pre>
      <h3 id="functions">Functions</h3>
      

      <h4 id="coap_add_resource">Func <span>coap_add_resource</span></h4>
      <pre class="doc-declare"><code>void coap_add_resource(coap_context_t *context, coap_resource_t *resource);</code></pre>
      <pre class="doc-comment">/**
 * Registers the given @p resource for @p context. The resource must have been
 * created by coap_resource_init() or coap_resource_unknown_init(), the
 * storage allocated for the resource will be released by coap_delete_resource().
 *
 * @param context  The context to use.
 * @param resource The resource to store.
 */</pre>

      <h4 id="coap_delete_resource">Func <span>coap_delete_resource</span></h4>
      <pre class="doc-declare"><code>int coap_delete_resource(coap_context_t *context, coap_resource_t *resource);</code></pre>
      <pre class="doc-comment">/**
 * Deletes a resource identified by @p resource. The storage allocated for that
 * resource is freed, and removed from the context.
 *
 * @param context  The context where the resources are stored.
 * @param resource The resource to delete.
 *
 * @return         @c 1 if the resource was found (and destroyed),
 *                 @c 0 otherwise.
 */</pre>

      <h4 id="coap_delete_all_resources">Func <span>coap_delete_all_resources</span></h4>
      <pre class="doc-declare"><code>void coap_delete_all_resources(coap_context_t *context);</code></pre>
      <pre class="doc-comment">/**
 * Deletes all resources from given @p context and frees their storage.
 *
 * @param context The CoAP context with the resources to be deleted.
 */</pre>

      <h4 id="coap_delete_attr">Func <span>coap_delete_attr</span></h4>
      <pre class="doc-declare"><code>void coap_delete_attr(coap_attr_t *attr);</code></pre>
      <pre class="doc-comment">/**
 * Deletes an attribute.
 * Note: This is for internal use only, as it is not deleted from its chain.
 *
 * @param attr Pointer to a previously created attribute.
 *
 */</pre>

      <h4 id="coap_print_link">Func <span>coap_print_link</span></h4>
      <pre class="doc-declare"><code>coap_print_status_t coap_print_link(const coap_resource_t *resource,
                                   unsigned char *buf,
                                   size_t *len,
                                   size_t *offset);</code></pre>
      <pre class="doc-comment">/**
 * Writes a description of this resource in link-format to given text buffer. @p
 * len must be initialized to the maximum length of @p buf and will be set to
 * the number of characters actually written if successful. This function
 * returns @c 1 on success or @c 0 on error.
 *
 * @param resource The resource to describe.
 * @param buf      The output buffer to write the description to.
 * @param len      Must be initialized to the length of @p buf and
 *                 will be set to the length of the printed link description.
 * @param offset   The offset within the resource description where to
 *                 start writing into @p buf. This is useful for dealing
 *                 with the Block2 option. @p offset is updated during
 *                 output as it is consumed.
 *
 * @return If COAP_PRINT_STATUS_ERROR is set, an error occured. Otherwise,
 *         the lower 28 bits will indicate the number of characters that
 *         have actually been output into @p buffer. The flag
 *         COAP_PRINT_STATUS_TRUNC indicates that the output has been
 *         truncated.
 */</pre>

      <h4 id="coap_register_handler">Func <span>coap_register_handler</span></h4>
      <pre class="doc-declare"><code>void coap_register_handler(coap_resource_t *resource,
                          unsigned char method,
                          coap_method_handler_t handler);</code></pre>
      <pre class="doc-comment">/**
 * Registers the specified @p handler as message handler for the request type @p
 * method
 *
 * @param resource The resource for which the handler shall be registered.
 * @param method   The CoAP request method to handle.
 * @param handler  The handler to register with @p resource.
 */</pre>

      <h4 id="coap_touch_observer">Func <span>coap_touch_observer</span></h4>
      <pre class="doc-declare"><code>void coap_touch_observer(coap_context_t *context,
                        coap_session_t *session,
                        const coap_binary_t *token);</code></pre>
      <pre class="doc-comment">/**
 * Marks an observer as alive.
 *
 * @param context  The CoAP context to use.
 * @param session  The observer's session
 * @param token    The corresponding token that has been used for the
 *                 subscription.
 */</pre>

      <h4 id="coap_delete_observer">Func <span>coap_delete_observer</span></h4>
      <pre class="doc-declare"><code>int coap_delete_observer(coap_resource_t *resource,
                        coap_session_t *session,
                        const coap_binary_t *token);</code></pre>
      <pre class="doc-comment">/**
 * Removes any subscription for @p observer from @p resource and releases the
 * allocated storage. The result is @c 1 if an observation relationship with @p
 * observer and @p token existed, @c 0 otherwise.
 *
 * @param resource The observed resource.
 * @param session  The observer's session.
 * @param token    The token that identifies this subscription or @c NULL for
 *                 any token.
 * @return         @c 1 if the observer has been deleted, @c 0 otherwise.
 */</pre>

      <h4 id="coap_delete_observers">Func <span>coap_delete_observers</span></h4>
      <pre class="doc-declare"><code>void coap_delete_observers(coap_context_t *context, coap_session_t *session);</code></pre>
      <pre class="doc-comment">/**
 * Removes any subscription for @p session and releases the allocated storage.
 *
 * @param context  The CoAP context to use.
 * @param session  The observer's session.
 */</pre>

      <h4 id="coap_check_notify">Func <span>coap_check_notify</span></h4>
      <pre class="doc-declare"><code>void coap_check_notify(coap_context_t *context);</code></pre>
      <pre class="doc-comment">/**
 * Checks for all known resources, if they are dirty and notifies subscribed
 * observers.
 */</pre>

      <h4 id="coap_print_wellknown">Func <span>coap_print_wellknown</span></h4>
      <pre class="doc-declare"><code>coap_print_status_t coap_print_wellknown(coap_context_t *,
                                        unsigned char *,
                                        size_t *, size_t,
                                        coap_opt_t *);</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="coap_handle_failed_notify">Func <span>coap_handle_failed_notify</span></h4>
      <pre class="doc-declare"><code>void
coap_handle_failed_notify(coap_context_t *,
                         coap_session_t *,
                         const coap_binary_t *);</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="coap_resource_notify_observers">Func <span>coap_resource_notify_observers</span></h4>
      <pre class="doc-declare"><code>int
coap_resource_notify_observers(coap_resource_t *resource,
                              const coap_string_t *query);</code></pre>
      <pre class="doc-comment">/**
 * Initiate the sending of an Observe packet for all observers of @p resource,
 * optionally matching @p query if not NULL
 *
 * @param resource The CoAP resource to use.
 * @param query    The Query to match against or NULL
 *
 * @return         @c 1 if the Observe has been triggered, @c 0 otherwise.
 */</pre>
      <h3 id="vars">Vars</h3>
      

      <h4 id="coap_resource_t">Variable <span>coap_resource_t</span></h4>
      <pre class="doc-declare"><code>coap_resource_t *coap_resource_init(coap_str_const_t *uri_path,
                                   int flags);</code></pre>
      <pre class="doc-comment">/**
 * Creates a new resource object and initializes the link field to the string
 * @p uri_path. This function returns the new coap_resource_t object.
 *
 * If the string is going to be freed off by coap_delete_resource() when
 * COAP_RESOURCE_FLAGS_RELEASE_URI is set in @p flags, then either the 's'
 * variable of coap_str_const_t has to point to constant text, or point to data
 * within the allocated coap_str_const_t parameter.
 *
 * @param uri_path The string URI path of the new resource.
 * @param flags    Flags for memory management (in particular release of
 *                 memory). Possible values:@n
 *
 *                 COAP_RESOURCE_FLAGS_RELEASE_URI
 *                  If this flag is set, the URI passed to
 *                  coap_resource_init() is free'd by
 *                  coap_delete_resource()@n
 *
 *                 COAP_RESOURCE_FLAGS_NOTIFY_CON
 *                  If this flag is set, coap-observe notifications
 *                  will be sent confirmable by default.@n
 *
 *                 COAP_RESOURCE_FLAGS_NOTIFY_NON (default)
 *                  If this flag is set, coap-observe notifications
 *                  will be sent non-confirmable by default.@n
 *
 *                  If flags is set to 0 then the
 *                  COAP_RESOURCE_FLAGS_NOTIFY_NON is considered.
 *
 * @return         A pointer to the new object or @c NULL on error.
 */</pre>

      <h4 id="coap_resource_t">Variable <span>coap_resource_t</span></h4>
      <pre class="doc-declare"><code>coap_resource_t *coap_resource_unknown_init(coap_method_handler_t put_handler);</code></pre>
      <pre class="doc-comment">/**
 * Creates a new resource object for the unknown resource handler with support
 * for PUT.
 *
 * In the same way that additional handlers can be added to the resource
 * created by coap_resource_init() by using coap_register_handler(), POST,
 * GET, DELETE etc. handlers can be added to this resource. It is the
 * responsibility of the application to manage the unknown resources by either
 * creating new resources with coap_resource_init() (which should have a
 * DELETE handler specified for the resource removal) or by maintaining an
 * active resource list.
 *
 * Note: There can only be one unknown resource handler per context - attaching
 *       a new one overrides the previous definition.
 *
 * Note: It is not possible to observe the unknown resource with a GET request
 *       - a separate resource needs to be reated by the PUT (or POST) handler,
 *       and make that resource observable.
 *
 * This function returns the new coap_resource_t object.
 *
 * @param put_handler The PUT handler to register with @p resource for
 *                    unknown Uri-Path.
 *
 * @return       A pointer to the new object or @c NULL on error.
 */</pre>

      <h4 id="coap_attr_t">Variable <span>coap_attr_t</span></h4>
      <pre class="doc-declare"><code>coap_attr_t *coap_add_attr(coap_resource_t *resource,
                          coap_str_const_t *name,
                          coap_str_const_t *value,
                          int flags);</code></pre>
      <pre class="doc-comment">/**
 * Registers a new attribute with the given @p resource. As the
 * attribute's coap_str_const_ fields will point to @p name and @p value the
 * caller must ensure that these pointers are valid during the
 * attribute's lifetime.

 * If the @p name and/or @p value string is going to be freed off at attribute
 * removal time by the setting of COAP_ATTR_FLAGS_RELEASE_NAME or
 * COAP_ATTR_FLAGS_RELEASE_VALUE in @p flags, then either the 's'
 * variable of coap_str_const_t has to point to constant text, or point to data
 * within the allocated coap_str_const_t parameter.
 *
 * @param resource The resource to register the attribute with.
 * @param name     The attribute's name as a string.
 * @param value    The attribute's value as a string or @c NULL if none.
 * @param flags    Flags for memory management (in particular release of
 *                 memory). Possible values:@n
 *
 *                 COAP_ATTR_FLAGS_RELEASE_NAME
 *                  If this flag is set, the name passed to
 *                  coap_add_attr_release() is free'd
 *                  when the attribute is deleted@n
 *
 *                 COAP_ATTR_FLAGS_RELEASE_VALUE
 *                  If this flag is set, the value passed to
 *                  coap_add_attr_release() is free'd
 *                  when the attribute is deleted@n
 *
 * @return         A pointer to the new attribute or @c NULL on error.
 */</pre>

      <h4 id="coap_attr_t">Variable <span>coap_attr_t</span></h4>
      <pre class="doc-declare"><code>coap_attr_t *coap_find_attr(coap_resource_t *resource,
                           coap_str_const_t *name);</code></pre>
      <pre class="doc-comment">/**
 * Returns @p resource's coap_attr_t object with given @p name if found, @c NULL
 * otherwise.
 *
 * @param resource The resource to search for attribute @p name.
 * @param name     Name of the requested attribute as a string.
 * @return         The first attribute with specified @p name or @c NULL if none
 *                 was found.
 */</pre>

      <h4 id="coap_resource_t">Variable <span>coap_resource_t</span></h4>
      <pre class="doc-declare"><code>coap_resource_t *coap_get_resource_from_uri_path(coap_context_t *context,
                                               coap_str_const_t *uri_path);</code></pre>
      <pre class="doc-comment">/**
 * Returns the resource identified by the unique string @p uri_path. If no
 * resource was found, this function returns @c NULL.
 *
 * @param context  The context to look for this resource.
 * @param uri_path  The unique string uri of the resource.
 *
 * @return         A pointer to the resource or @c NULL if not found.
 */</pre>

      <h4 id="coap_subscription_t">Variable <span>coap_subscription_t</span></h4>
      <pre class="doc-declare"><code>coap_subscription_t *coap_add_observer(coap_resource_t *resource,
                                      coap_session_t *session,
                                      const coap_binary_t *token,
                                      coap_string_t *query,
                                      int has_block2,
                                      coap_block_t block2);</code></pre>
      <pre class="doc-comment">/**
 * Adds the specified peer as observer for @p resource. The subscription is
 * identified by the given @p token. This function returns the registered
 * subscription information if the @p observer has been added, or @c NULL on
 * error.
 *
 * @param resource        The observed resource.
 * @param session         The observer's session
 * @param token           The token that identifies this subscription.
 * @param query           The query string, if any. subscription will
                          take ownership of the string.
 * @param has_block2      If Option Block2 defined.
 * @param block2          Contents of Block2 if Block 2 defined.
 * @return                A pointer to the added/updated subscription
 *                        information or @c NULL on error.
 */</pre>

      <h4 id="coap_subscription_t">Variable <span>coap_subscription_t</span></h4>
      <pre class="doc-declare"><code>coap_subscription_t *coap_find_observer(coap_resource_t *resource,
                                       coap_session_t *session,
                                       const coap_binary_t *token);</code></pre>
      <pre class="doc-comment">/**
 * Returns a subscription object for given @p peer.
 *
 * @param resource The observed resource.
 * @param session  The observer's session
 * @param token    The token that identifies this subscription or @c NULL for
 *                 any token.
 * @return         A valid subscription if exists or @c NULL otherwise.
 */</pre>

      <h4 id="COAP_DEPRECATED">Variable <span>COAP_DEPRECATED</span></h4>
      <pre class="doc-declare"><code>COAP_DEPRECATED int
coap_resource_set_dirty(coap_resource_t *r,
                       const coap_string_t *query);</code></pre>
      <pre class="doc-comment">/**
 * @deprecated use coap_resource_notify_observers() instead.
 */</pre>
      <h3 id="consts">Consts</h3>
      
      <h3 id="types">Types</h3>
      
      <h3 id="typedefs">Typedefs</h3>
      

      <h4 id="coap_method_handler_t">Typedef <span>coap_method_handler_t</span></h4>
      <pre class="doc-declare"><code>typedef void (*coap_method_handler_t)
 (coap_context_t *,
  struct coap_resource_t *,
  coap_session_t *,
  coap_pdu_t *,
  coap_binary_t * /* token */,
  coap_string_t * /* query string */,
  coap_pdu_t * /* response */);
</code></pre>
      <pre class="doc-comment">/**
 * Definition of message handler function (@sa coap_resource_t).
 */</pre>

      <h4 id="coap_attr_t;
">Typedef <span>coap_attr_t;
</span></h4>
      <pre class="doc-declare"><code>typedef struct coap_attr_t {
 struct coap_attr_t *next;
 coap_str_const_t *name;
 coap_str_const_t *value;
 int flags;
} coap_attr_t;
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="coap_resource_t;
">Typedef <span>coap_resource_t;
</span></h4>
      <pre class="doc-declare"><code>typedef struct coap_resource_t {
 unsigned int dirty:1;         /**< set to 1 if resource has changed */
 unsigned int partiallydirty:1; /**< set to 1 if some subscribers have not yet
                                  *   been notified of the last change */
 unsigned int observable:1;    /**< can be observed */
 unsigned int cacheable:1;     /**< can be cached */
 unsigned int is_unknown:1;    /**< resource created for unknown handler */

 /**
   * Used to store handlers for the seven coap methods @c GET, @c POST, @c PUT,
   * @c DELETE, @c FETCH, @c PATCH and @c IPATCH.
   * coap_dispatch() will pass incoming requests to the handler
   * that corresponds to its request method or generate a 4.05 response if no
   * handler is available.
   */
 coap_method_handler_t handler[7];

 UT_hash_handle hh;

 coap_attr_t *link_attr; /**< attributes to be included with the link format */
 coap_subscription_t *subscribers; /**< list of observers for this resource */

 /**
   * Request URI Path for this resource. This field will point into static
   * or allocated memory which must remain there for the duration of the
   * resource.
   */
 coap_str_const_t *uri_path; /**< the key used for hash lookup for this resource */
 int flags;

 /**
  * The next value for the Observe option. This field must be increased each
  * time the resource changes. Only the lower 24 bits are sent.
  */
 unsigned int observe;

 /**
   * This pointer is under user control. It can be used to store context for
   * the coap handler.
   */
 void *user_data;

} coap_resource_t;
</code></pre>
      <pre class="doc-comment"></pre>

      <h4 id="coap_print_status_t">Typedef <span>coap_print_status_t</span></h4>
      <pre class="doc-declare"><code>typedef unsigned int coap_print_status_t;
</code></pre>
      <pre class="doc-comment">/**
 * Status word to encode the result of conditional print or copy operations such
 * as coap_print_link(). The lower 28 bits of coap_print_status_t are used to
 * encode the number of characters that has actually been printed, bits 28 to 31
 * encode the status.  When COAP_PRINT_STATUS_ERROR is set, an error occurred
 * during output. In this case, the other bits are undefined.
 * COAP_PRINT_STATUS_TRUNC indicates that the output is truncated, i.e. the
 * printing would have exceeded the current buffer.
 */</pre>
    </div>
  </body>
</html>
            